package de.unidue.masterproject.plugin;

import de.unidue.masterproject.ccc.exceptions.P2PCommunicationException;
import de.unidue.masterproject.ccc.exceptions.WrongValueException;
import de.unidue.masterproject.generalmodel.P2PCommunicationObject;
import de.unidue.masterproject.generalplugin.*;





public class Plugin3 extends GeneralPlugin {

	public Plugin3(){
		System.out.println("Plugin3 geladen");
	}

	@Override
	public void run(boolean fistStart){
		
		
		
//		try {
//			p2pCS.sendObject(new P2PCommunicationObject("LiteratureManagemementPlugin", 0, false, false, "Nachricht1 vom Plugin3, der nichts senden darf"), this);
//		} catch (P2PCommunicationException e1) {
//			System.out.println("Kommunikationsfehler: "+e1.getMessage());
//		}
		
	}

	@Override
	public void createMetaInfo() {
		String[] s = {"auch nichts :-("};
		try {
			plugInMetaInfo = new PlugInMetaInfo("Plugin3", 0.1, "Ich", 0, false, false, false, false, false, s, null, null);
		} catch (WrongValueException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Override
	public void receiveP2PObject(String senderName, double senderVersion,
			P2PCommunicationObject p2pCO) throws P2PCommunicationException {
		System.out.println("Nachricht von "+senderName+"("+senderVersion+") in Plugin3 erhalten:\n"+(String)p2pCO.getMessageObject());
		
	}

	@Override
	protected void terminate() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void performUpdate(double oldVersion) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void prepareUpdate(double oldVersion) {
		// TODO Auto-generated method stub
		
	}
		
}
